/**
 * Copyright © 2013 Creativor Studio.
 * About license information, please see LICENSE.txt.
 */
package org.creativor.rayson.api.server;

import org.creativor.rayson.api.Protocol;
import org.creativor.rayson.api.exception.IllegalProtocolException;
import org.creativor.rayson.api.server.exception.DuplicateServiceException;
import org.creativor.rayson.api.server.exception.NoSuchServiceException;
import org.creativor.rayson.share.annotation.NotNull;

/**
 * An RPC service container.
 * 
 * @author creativor
 */
public interface RpcContainer {
	/**
	 * Add an service to this container.
	 * 
	 * @param service
	 * @param protocols
	 *            Protocol classes that the service stands for.
	 * @throws DuplicateServiceException
	 */
	public void addService(@NotNull Protocol service,
			Class<? extends Protocol>... protocols)
			throws DuplicateServiceException, IllegalProtocolException;

	/**
	 * Remove an service by giving an protocol class.
	 * 
	 * @param protocol
	 */
	public void removeService(@NotNull Class<? extends Protocol> protocol)
			throws NoSuchServiceException;
}
